package com.example.template.jdbc;

import javax.sql.DataSource;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;

public class MemberDao extends JdbcTemplate {

    public MemberDao(DataSource dataSource) {
        super(dataSource);
    }

    public List<?> queryAll(Object[] params) {
        return super.executeQuery("select * from t_member", (RowMapper<Member>) (resultSet, rowNum) -> {
            Member member = new Member();
            member.setAddr(resultSet.getString(rowNum));
            member.setAge(resultSet.getInt("age"));
            member.setName(resultSet.getString("name"));
            return member;
        }, params);
    }

}
